<template>
  <el-dialog
    top="30px"
    width="80%"
    append-to-body
    :visible.sync="visible"
    :close-on-click-modal="false"
    :before-close="beforeClose"
  >
    <el-tabs v-model="active">
      <el-tab-pane label="项目信息" name="first">
        <info-view :related-data="relatedData"></info-view>
      </el-tab-pane>

      <el-tab-pane label="担保意向函" name="letter">
        <letter-view :query-id="queryId"></letter-view>
      </el-tab-pane>
      <el-tab-pane label="放款通知书" name="notice">
        <loan-notice :query-id="queryId"></loan-notice>
      </el-tab-pane>

      <!-- <el-tab-pane label="附件">
        <attach-main :query-id="queryId" view-mode ref="attach"></attach-main>
      </el-tab-pane> -->
    </el-tabs>
  </el-dialog>
</template>

<script>
import LetterView from '@/credit/views/county/unionProvince/components/LetterView'
// import AttachMain from '@/credit/components/AttachView'
import InfoView from '@/credit/views/city/bus/normal/Info'
import LoanNotice from '@/credit/views/county/unionProvince/components/LoanNotice'
export default {
  components: {
    LetterView,
    // AttachMain,
    InfoView,
    LoanNotice,
  },
  props: {
    visible: Boolean,
    relatedData: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      active: 'first',
    }
  },
  computed: {
    queryId() {
      return this.relatedData.customer_related_id || ''
    },
    hasItem() {
      return +this.relatedData.item_status === 1
    },
  },
  watch: {
    visible(val) {
      if (val) {
        this.$refs.attach && this.$refs.attach.getData()
      }
    },
  },
  created() {},
  mounted() {},
  methods: {
    beforeClose() {
      this.active = 'first'
      this.$emit('update:visible', false)
    },
  },
}
</script>

<style lang="scss" scoped></style>
